package com.audaque.springboot.foshanupload.amqp.config;

import org.springframework.amqp.AmqpException;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.core.MessagePostProcessor;
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
import org.springframework.amqp.support.converter.MessageConverter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author zgb
 * @desc ...
 * @date 2024-01-06 21:15:22
 */
@Configuration
public class MessageConfig {
  @Bean
  public MessageConverter messageConverter() {
	// 1.定义消息转换器
	Jackson2JsonMessageConverter jjmc = new Jackson2JsonMessageConverter();
	// 2.配置自动创建消息id，用于识别不同消息，也可以在业务中基于ID判断是否是重复消息
	jjmc.setCreateMessageIds(true);
	return jjmc;
  }

}
